package pa1.sockets;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
	
	public static void main(String[] args){
		try {
			//create a new serversocket which accepts new connections
			ServerSocket serverSocket = new ServerSocket(4444);
			Socket clientSocket;
		
			Logger log = new Logger();
			
			while(true){
				//wait for new connections
				clientSocket = serverSocket.accept();
				System.out.println("New Connection");
				//create a new thread which handels the new connection
				ServerThread eventServer = new ServerThread(clientSocket, log);
				eventServer.start();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
